package com.wiscamp.ninechapters.problems.infrastructure.mappers.assessments;

import com.wiscamp.ninechapters.problems.infrastructure.po.assessments.AssessmentPO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface AssessmentMapper extends JpaRepository<AssessmentPO, Long>, JpaSpecificationExecutor<AssessmentPO> {

    @Query(value = "select e from AssessmentPO e where e.assessmentCode = :code and e.subjectId = :subjectId and e.active = true and e.deleted = false")
    AssessmentPO findAssessmentByCode(String code, long subjectId);
}